# $Id$
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
plugrel=3
_pkgbase='motion'
pkgname=motion-noffmpeg
pkgver=3.2.12
provides=('motion')
replaces=('motion')
conflicts=('motion')
pkgrel=3
pkgdesc="A software motion detector which grabs images from video4linux devices and/or from webcams, built without FFMPEG, and requires fewer dependencies (~47MB -> ~3MB) "
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome"
depends=('libjpeg' 'v4l-utils')
backup=('etc/motion/motion.conf')
options=('!makeflags')
source=(http://downloads.sourceforge.net/${_pkgbase}/${_pkgbase}-${pkgver}.tar.gz
	rc.motion
	linux-headers.patch
	noffmpeg.patch)
md5sums=('1ba0065ed50509aaffb171594c689f46'
         '77be944e4466ab66836d50ea216af3b6'
	 'ea917c4ac459cd26a6d161d4e759f0dc'
	 '106a149dba24db497e89af7fca886348')


build() {
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  patch -p1 motion-dist.conf.in < $srcdir/noffmpeg.patch
  patch -Np1 -i $srcdir/linux-headers.patch
  ./configure --prefix=/usr \
    --without-pgsql \
    --without-ffmpeg \
    --without-mysql \
    --sysconfdir=/etc/motion
  make
}

package(){
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  mv "${pkgdir}/etc/motion/motion-dist.conf" "${pkgdir}/etc/motion/motion.conf"

  install -Dm755 "${srcdir}/rc.motion" "${pkgdir}/etc/rc.d/motion"
}
